using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class MenuView : MonoBehaviour
{
	public MenuManager_exo menuManager;
	public List<UIButtonMessage> btnMenu;
	public List<GameObject> UIMenu;
	public List<GameObject> InventoryUI;
	public GameObject menuPanel;
	public GameObject inventoryPanel;

	void Awake()
	{

	}
	// Use this for initialization
	void Start ()
	{
		DeactivateOnStart ();
	}
	
	// Update is called once per frame
	void Update ()
	{
		menuManager = GameObject.Find ("MenuManager").GetComponent<MenuManager_exo> ();
	}
	public void DeactivateOnStart()
	{
		for(int i = 0; i<UIMenu.Count; i++)
		{
			if(UIMenu[i].name != "TextboxUI" && UIMenu[i].name != "NameTextboxUI" && UIMenu[i].name != "GameUI" && UIMenu[i].name != "ItemBoxPanel")
			UIMenu[i].SetActive(false);
		}

	}
	public void onCancel()
	{
		menuManager.ReturnToGame();
	}

	public void onActiveLog()
	{
		menuManager.OpenBacklog();
	}

	public void onActiveSave()
	{
		menuManager.OpenSaveMenu();
	}

	public void onActiveLoad()
	{
		menuManager.OpenLoadMenu();
	}

	public void onQuickLoad()
	{
		FileLoader fl = new FileLoader();
		fl.QuickLoad();
	}

	public void onActiveSettings()
	{
		menuManager.OpenSettingsMenu ();
	}

	//--insert inventory display code.
	public void onActiveInventory()
	{
		menuManager.OpenInventory ();
	}

	public void onActiveChoiceInventory()
	{
		menuManager.OpenChoiceInventory();
	}

	void OnLevelWasLoaded(int level)
	{
		UIMenu.Find (x => x.name == "TextboxUI").SetActive (true);
		UIMenu.Find (x => x.name == "NameTextboxUI").SetActive (true);
		UIMenu.Find (x => x.name == "GameUI").SetActive (true);
		UIMenu.Find (x => x.name == "ItemBoxPanel").SetActive (true);
	}
}